package com.example.common.config.common.orika;

import lombok.extern.slf4j.Slf4j;
import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author admin
 * @Title:
 * @Package
 * @Description:
 * @date 2021/9/315:31
 */
@Slf4j
@Configuration
public class OrikaConfig {
    @Bean
    public MapperFactory mapperFactory() {
        log.info(">>>>>>>>>>>>>>>> common mapper factory init starting >>>>>>>>>>>>>>>>>>>>>");
        return new DefaultMapperFactory.Builder().build();
    }

    @Bean
    public MapperFacade mapperFacade() {
        log.info(">>>>>>>>>>>>>>>> common mapper facade init starting >>>>>>>>>>>>>>>>>>>>>");
        return mapperFactory().getMapperFacade();
    }
}
